
import Api from '@/database'
import { defineWrappedResponseHandler } from '../utils/handler'

const handler = defineEventHandler(async (e) => {
  const { table, column, conditions, groupBy } = await readBody(e)
  return await Api.aggregate.sum(table, column, conditions, groupBy)
})

export default defineWrappedResponseHandler(handler)